<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>物料出库审批</title>
    <link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/common.css" />
    <link rel="stylesheet" href="../css/mui.picker.min.css">
    <style type="text/css">
        .detail {
            padding-right: 20px!important;
        }

        h5 {
            color: #0062CC;
        }
        #close{
          display: none;
        }

        .mui-navigate-right .mui-col-xs-8 {
            width: 62.666667%!important;
        }

        .mui-text-right input,
        .mui-text-right textarea {
            border: 0;
            font-size: 14px;
            font-weight: 400;
            color: #8f8f94;
            margin-bottom: 0;
            text-align: right;
        }

        .flex_first{
          display: flex;
          align-items: flex-start;
        }

        .padding_r_18{
          padding: 0 16px 0 0;
        }
        .mui-btn-primary {
      	    border-radius: 3px;
      	    width: 45%;
      	}
        .btn_group{
          display: flex;
          align-items: center;
          justify-content: space-around;
        }
        .btn_group > div{
          width: 30%;
        }
    </style>
</head>

<body>
    <div class="mui-content content-padded_bottom">
        <ul class="mui-table-view mui-table-view-chevron">
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">SGMW ID：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="itemnum"></span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail" onclick="openSelStock()">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">库存地址：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="binnum"></span>
                    </div>
                </div>
            </li>
        </ul>
        <ul class="mui-table-view mui-table-view-chevron type_list_spair">
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">工单：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="refwo"></span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">状态：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span id="stauts" class="mui-h5"></span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">位置：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="address"></span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">交易类型：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="issuetype"></span>
                    </div>
                </div>
            </li>
        </ul>
        <ul class="mui-table-view mui-table-view-chevron type_list_spair">
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">领料人：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="issuerto"></span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">姓名：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="name"></span>
                    </div>
                </div>
            </li>
        </ul>
        <ul class="mui-table-view mui-table-view-chevron type_list_spair">
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">发放日期：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="actualdate"></span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">发放数量：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right no_padding">
                        <input type="number" placeholder="请输入发放数量" name="quantity" id="quantity" value="" />
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell detail">
                <div class="mui-table flex_first">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">描述：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                    	<span class="mui-h5" id="description"></span>
                    </div>
                </div>
            </li>
        </ul>
        <div class="btn_group" style="text-align: center; margin: 20px auto;">
    			<div class="mui-btn mui-btn-primary mui-disabled" tapmode onclick="checkOut('0')">
    				退回修改
    			</div>
    			<div class="mui-btn mui-btn-primary" tapmode onclick="checkOut('1')">
    				确认出库
    			</div>
          <div class="mui-btn mui-btn-primary mui-disabled" id='close' tapmode onclick="closeOrder()">
            关闭
          </div>
    		</div>
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script src="../script/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../script/common.js" type="text/javascript" charset="utf-8"></script>
<script src="../script/mui.picker.min.js"></script>
<script type="text/javascript">
  var matusetransid = ''
  apiready = function () {
    $api.text($api.byId('itemnum'),api.pageParam.itemnum);
    onLoadData(curPage,false);
    api.parseTapmode();
  }
  function onLoadData (page,load) {
		ajaxrd("queryCheckOutDetail", {
			matusetransid: api.pageParam.matusetransid
		}, function(ret, err) {
			$api.text($api.byId('itemnum'),ret.itemnum);
			$api.text($api.byId('refwo'),ret.refwo);
			$api.text($api.byId('stauts'),ret.status);
			$api.text($api.byId('address'),ret.location+'/'+ret.locationDesc);
			$api.text($api.byId('issuetype'),ret.issuetype);
			$api.text($api.byId('issuerto'),ret.issueto);
			$api.text($api.byId('name'),ret.issuertoName);
			$api.text($api.byId('binnum'),ret.binnum);
			$api.text($api.byId('actualdate'),ret.actualdate);
			$api.val($api.byId('quantity'),ret.quantity);
			$api.text($api.byId('description'),ret.description);
      matusetransid = ret.matusetransid
      if (ret.refwo == '' && ret.isAdmin == 1) {
        document.getElementById('close').style.display = 'block'
      }
		})
	}
  function closeOrder() {
    ajaxrd("deleteBlankNoteById",{
      matusetransid: matusetransid
    },function(data){
      api.sendEvent({
          name: 'refersh',
          extra: {
              isrefersh: 'yes'
          }
      });
      setTimeout(function(){api.closeWin();},500)
    })
  }
  function checkOut (issure) {
       ajaxrd("checkOut",{
         matusetransid:api.pageParam.matusetransid,
         issure: issure,
         invbalancesid:api.pageParam.invbalancesid,
         quantity:  Math.abs(parseFloat($api.val($api.byId('quantity'))))
       },function(data){
       	if (issure == '1') {
       		Toast('出库成功');
       	}else{
       		Toast('退回成功');
       	}
       	api.sendEvent({
            name: 'refersh',
            extra: {
                isrefersh: 'yes'
            }
        });
         setTimeout(function(){api.closeWin();},500)
       })
  }
</script>

</html>
